package com.liyuhan.onlinetaxibackground.Controller;

import com.liyuhan.onlinetaxibackground.Service.UserService;
import com.liyuhan.onlinetaxibackground.dto.DataResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

@RestController
@RequestMapping("/user")
public class UserController {
    @Autowired
    private UserService userService;

    @RequestMapping("/getUserInfo")
    public DataResponse getUserInfo(@Valid @RequestBody String request) {
        return userService.getUserInfo(request);
    }

    @RequestMapping("/getNickName")
    public DataResponse getNickName(@Valid @RequestBody String request) {
        return userService.getNickName(request);
    }

    @RequestMapping("/saveUserBasicInfo")
    public void saveUserBasicInfo(@Valid @RequestBody String request) {
        userService.saveUserBasicInfo(request);
    }

    @RequestMapping("/changePassword")
    public DataResponse changePassword(@Valid @RequestBody String request) {
        // 根据用户phone和newPassword进行密码修改
        return userService.changePassword(request);
    }

    @RequestMapping("/getUserBasicInfo")
    public DataResponse getUserBasicInfo(@Valid @RequestBody String request) {
        return userService.getUserBasicInfo(request);
    }

    @RequestMapping("/getWeeklyOrderCount")
    public DataResponse getWeeklyOrderCount(@Valid @RequestBody String request) {
        // 根据用户phone查找最近一周订单数量的统计数据
        return userService.getWeeklyOrderCount(request);
    }

    @RequestMapping("/getWeeklyCostCount")
    public DataResponse getWeeklyCostCount(@Valid @RequestBody String request) {
        // 根据用户phone查找最近一周用户支付的金额
        return userService.getWeeklyCostCount(request);
    }

    @RequestMapping("/getWeeklyIncomeCount")
    public DataResponse getWeeklyIncomeCount(@Valid @RequestBody String request) {
        // 根据用户phone查找最近一周司机的收益
        return userService.getWeeklyIncomeCount(request);
    }

    @RequestMapping("/getWeeklyTaxiLocation")
    public DataResponse getWeeklyTaxiLocation(@Valid @RequestBody String request) {
        // 根据用户phone查找最近一周用户支付的金额
        return userService.getWeeklyTaxiLocation(request);
    }

    @RequestMapping("/getWeeklyOrderType")
    public DataResponse getWeeklyOrderType(@Valid @RequestBody String request) {
        // 根据用户phone查找最近一周用户支付的金额
        return userService.getWeeklyOrderType(request);
    }
}
